2 ==============================================================================
4 Demonstration "Hello World" application in JUCE
5 Copyright 2008 by Julian Storer.
7 ==============================================================================
10 #include "../JuceLibraryCode/JuceHeader.h"
11 #include "MainComponent.h"
13 //==============================================================================
15 This is the top-level window that we'll pop up. Inside it, we'll create and
16 show a component from the MainComponent.cpp file (you can open this file using
17 the Jucer to edit it).
19 class HelloWorldWindow
: public DocumentWindow
22 //==============================================================================
24 : DocumentWindow ("JUCE Hello World!",
26 DocumentWindow::allButtons
,
29 // Create an instance of our main content component, and add it to our window..
30 setContentOwned (new MainComponent(), true);
32 // Centre the window on the screen
33 centreWithSize (getWidth(), getHeight());
41 // (the content component will be deleted automatically, so no need to do it here)
44 //==============================================================================
45 void closeButtonPressed()
47 // When the user presses the close button, we'll tell the app to quit. This
48 // HelloWorldWindow object will be deleted by the JUCEHelloWorldApplication class.
49 JUCEApplication::quit();
53 //==============================================================================
54 /** This is the application object that is started up when Juce starts. It handles
55 the initialisation and shutdown of the whole application.
57 class JUCEHelloWorldApplication
: public JUCEApplication
60 //==============================================================================
61 JUCEHelloWorldApplication()
65 ~JUCEHelloWorldApplication()
69 //==============================================================================
70 void initialise (const String
& commandLine
)
72 // For this demo, we'll just create the main window...
73 helloWorldWindow
= new HelloWorldWindow();
75 /* ..and now return, which will fall into to the main event
76 dispatch loop, and this will run until something calls
77 JUCEAppliction::quit().
79 In this case, JUCEAppliction::quit() will be called by the
80 hello world window being clicked.
86 // This method is where you should clear-up your app's resources..
88 // The helloWorldWindow variable is a ScopedPointer, so setting it to a null
89 // pointer will delete the window.
93 //==============================================================================
94 const String
getApplicationName()
96 return "Hello World for JUCE";
99 const String
getApplicationVersion()
101 // The ProjectInfo::versionString value is automatically updated by the Jucer, and
102 // can be found in the JuceHeader.h file that it generates for our project.
103 return ProjectInfo::versionString
;
106 bool moreThanOneInstanceAllowed()
111 void anotherInstanceStarted (const String
& commandLine
)
116 ScopedPointer
<HelloWorldWindow
> helloWorldWindow
;
120 //==============================================================================
121 // This macro creates the application's main() function..
122 START_JUCE_APPLICATION (JUCEHelloWorldApplication
)